faApp.controller('HongbaoListCtrl',['$scope','hongbaoService','$location','$controller','$routeParams','$filter','exportService',function($scope,hongbaoService,$location,$controller,$routeParams,$filter,exportService) {   
  $controller('BaseListCtrl', {$scope: $scope}); 

  $scope.config = {
    "pageSize" : 200,
    "pageNo" : 1,
  };
  $scope.$watch('config',function(){
    hongbaoService.hongbaoList($scope.config).then(function(json){
      $scope.list = json.list;
      $scope.pager = json.pager;
    });
  },true);


  $scope.export = function(){
    exportService.exportCSV($scope.config,"HONGBAO_LIST_EXPORT");
  };
}]);

faApp.controller('HongbaoDetailCtrl',['$scope','hongbaoService','$location','$controller','$routeParams','$filter',function($scope,hongbaoService,$location,$controller,$routeParams,$filter) {   
  $controller('BaseCtrl', {$scope: $scope}); 

  $scope.config={fpGroupId:$routeParams.fpGroupId};
  $scope.listGroup={};
  $scope.listMember={};
  hongbaoService.hongbaoDetail($scope.config).then(function(json){
    $scope.listGroup=json.listGroup[0];
    $scope.listMember=json.listMember;
  });
  $scope.changeGroup=function(){
    
  hongbaoService.hongbaoJihuo($scope.config).then(function(json){
    if(json.statusCode==4009){
      alert("认证人数不足");
      return ;
    }else if (json.statusCode){
      alert("出错了:" + json.statusCode);
    }else{
      alert("激活成功");
    }
  });
  }


}]);
